﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WorkOut.aspx.cs" Inherits="FatFreeFitness._secured.members.WorkOut" masterpagefile="../../_layout/_master/MemberMaster.master" %>
<asp:Content id="Content1" runat="Server" contentplaceholderid="MemberContent">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            width: 362px;
        }
    </style>
    <div>
                <asp:HiddenField ID="hidWorkoutID" runat="server" />
                <asp:HiddenField ID="hidRoutineID" runat="server" />
                <asp:FormView ID="FormView1" runat="server" DataKeyNames="ID" 
                    DataSourceID="EntityDsRoutines" Width="542px">
                    <ItemTemplate>
                        <asp:HiddenField ID="hidRoutineID" runat="server" Value='<%# Eval("ID") %>' />
                        Routine:
                        <asp:Label ID="NameLabel" runat="server" Text='<%# Bind("Name") %>' />
                        <br />
                        Description:
                        <asp:Label ID="DescriptionLabel" runat="server" 
                            Text='<%# Bind("Description") %>' />
                        <br />
                        <br />

                    </ItemTemplate>
                </asp:FormView>
                <br />
    </div>
    <asp:EntityDataSource ID="EntityDsRoutines" runat="server" 
        ConnectionString="name=FatFreeFitnessEntities" 
        DefaultContainerName="FatFreeFitnessEntities" EnableFlattening="False" 
        EntitySetName="TemplateRoutines" 
        Where="" EntityTypeFilter="" Select="" AutoGenerateWhereClause="true">
        <WhereParameters>
            <asp:ControlParameter ControlID="hidRoutineID" Name="ID" 
                PropertyName="Value" Type="Int32" />
        </WhereParameters>
    </asp:EntityDataSource>
    <telerik:RadMultiPage ID="RadMultiPage1" Runat="server" Height="100%" 
        Width="100%" SelectedIndex="0">
        <telerik:RadPageView ID="pageviewStart" runat="server">
            Workout Date:
            <telerik:RadDatePicker ID="RadDatePicker1" Runat="server" Culture="en-US" 
                DbSelectedDate='<%# Bind("Date") %>'>
            </telerik:RadDatePicker>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Button ID="btnRecordDetails" runat="server" 
                onclick="btnRecordDetails_Click" Text="Record Details" />
        </telerik:RadPageView>
        <telerik:RadPageView ID="pageviewDetails" runat="server">
            <asp:EntityDataSource ID="EntityDsSteps" runat="server" 
                ConnectionString="name=FatFreeFitnessEntities" 
                DefaultContainerName="FatFreeFitnessEntities" EnableFlattening="False" 
                EntitySetName="TemplateSteps" EntityTypeFilter="" Select="" 
                Where="EXISTS(SELECT VALUE r FROM it.TemplateRoutineSteps AS r WHERE r.RoutineID = @RoutineID)" 
                >
                <WhereParameters>
                    <asp:ControlParameter ControlID="hidRoutineID" Name="RoutineID" 
                        PropertyName="Value" Type="Int32" />
                </WhereParameters>
            </asp:EntityDataSource>
            <telerik:RadListView ID="RadListView2" runat="server" DataKeyNames="ID" 
                DataSourceID="EntityDsSteps">
                <LayoutTemplate>
                    <div class="RadListView RadListView_Default">
                        <div ID="itemPlaceholder" runat="server">
                        </div>
                    </div>
                </LayoutTemplate>
                <ItemTemplate>
                    <div class="rlvI">
                        <asp:HiddenField ID="hidStepID" runat="server" Value='<%# Eval("ID") %>' />
                        <asp:EntityDataSource ID="EntityDsWorkoutDetails" runat="server" 
                            ConnectionString="name=FatFreeFitnessEntities" 
                            DefaultContainerName="FatFreeFitnessEntities" EnableFlattening="False" 
                            EnableInsert="True" EnableUpdate="True" EntitySetName="WorkOutDetails" Where="" AutoGenerateWhereClause="true">
                            <WhereParameters>
                                <asp:ControlParameter ControlID="hidStepID" Name="StepID" 
                                    PropertyName="Value" Type="Int32" />
                                <asp:ControlParameter ControlID="hidWorkoutID" Name="WorkoutID" 
                                    PropertyName="Value" Type="Int32" />
                            </WhereParameters>
                            <InsertParameters>
                                <asp:ControlParameter ControlID="hidStepID" Name="StepID" 
                                    PropertyName="Value" Type="Int32" />
                                <asp:ControlParameter ControlID="hidWorkoutID" Name="WorkoutID" 
                                    PropertyName="Value" Type="Int32" />
                            </InsertParameters>
                            <UpdateParameters>
                                <asp:ControlParameter ControlID="hidStepID" Name="StepID" 
                                    PropertyName="Value" Type="Int32" />
                                <asp:ControlParameter ControlID="hidWorkoutID" Name="WorkoutID" 
                                    PropertyName="Value" Type="Int32" />
                            </UpdateParameters>
                        </asp:EntityDataSource>
                        <table class="style1">
                            <tr>
                                <td class="style2">
                                    Goal</td>
                                <td>
                                    Actual</td>
                            </tr>
                            <tr>
                                <td class="style2">
                                    Step Name:
                                    <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                                    &nbsp;<br />Description:
                                    <asp:Label ID="DescriptionLabel" runat="server" 
                                        Text='<%# Eval("Description") %>' />
                                    &nbsp;<br />Target Sets:
                                    <asp:Label ID="DefaultSetsLabel" runat="server" 
                                        Text='<%# Eval("DefaultSets") %>' />
                                    <br />
                                    Target Reps:&nbsp;<asp:Label ID="DefaultRepsLabel" runat="server" 
                                        Text='<%# Eval("DefaultReps") %>' />
                                    &nbsp;<br />Target Resistance:
                                    <asp:Label ID="BaseResistanceLabel" runat="server" 
                                        Text='<%# Eval("BaseResistance") %>' />
                                    &nbsp;&nbsp;</td>
                                <td>
                                    <asp:FormView ID="FormView2" runat="server" DataKeyNames="WorkoutID,StepID" 
                                        DataSourceID="EntityDsWorkoutDetails" DefaultMode="Insert" Width="100%" 
                                        oniteminserted="FormView2_ItemInserted">
                                        <EditItemTemplate>
                                            Sets:
                                            <asp:TextBox ID="SetsTextBox" runat="server" Text='<%# Bind("Sets") %>' />
                                            <br />
                                            Reps:
                                            <asp:TextBox ID="RepsTextBox" runat="server" Text='<%# Bind("Reps") %>' />
                                            <br />
                                            Resistance:
                                            <asp:TextBox ID="ResistanceTextBox" runat="server" 
                                                Text='<%# Bind("Resistance") %>' />
                                            <br />
                                            <br />
                                            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                                                CommandName="Update" Text="Update" />
                                            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                                                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                                        </EditItemTemplate>
                                        <InsertItemTemplate>
                                            Sets:
                                            <asp:TextBox ID="SetsTextBox" runat="server" Text='<%# Bind("Sets") %>' />
                                            <br />
                                            Reps:
                                            <asp:TextBox ID="RepsTextBox" runat="server" Text='<%# Bind("Reps") %>' />
                                            <br />
                                            Resistance:
                                            <asp:TextBox ID="ResistanceTextBox" runat="server" 
                                                Text='<%# Bind("Resistance") %>' />
                                            <br />
                                            <br />
                                            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                                                CommandName="Insert" Text="Record" />
                                            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                                                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                                        </InsertItemTemplate>
                                        <ItemTemplate>
                                            Sets:
                                            <asp:Label ID="SetsLabel" runat="server" Text='<%# Bind("Sets") %>' />
                                            <br />
                                            Reps:
                                            <asp:Label ID="RepsLabel" runat="server" Text='<%# Bind("Reps") %>' />
                                            <br />
                                            Resistance:
                                            <asp:Label ID="ResistanceLabel" runat="server" 
                                                Text='<%# Bind("Resistance") %>' />
                                            <br />
                                            <br />
                                            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                                                CommandName="Edit" Text="Edit" />
                                            &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                                                CommandName="New" Text="New" />
                                        </ItemTemplate>
                                    </asp:FormView>
                                </td>
                            </tr>
                        </table>
                        <br />
                    </div>
                </ItemTemplate>
                <EmptyDataTemplate>
                    <div class="RadListView RadListView_Default">
                        <div class="rlvEmpty">
                            There are no items to be displayed.</div>
                    </div>
                </EmptyDataTemplate>
            </telerik:RadListView>
        </telerik:RadPageView>
    </telerik:RadMultiPage>
    </asp:Content>
